<style>
    /*弹出页面*/
    .single-page .side { border-right: 1px solid #d4d4d4; }
    .single-page #main { padding: 0; }
    .single-page .msgbox { left: auto; right: 20px; }
    .single-page .content-foot { overflow: visible; height: auto; }
    .single-page .tableform { background: #f8f8f8; margin: 5px 10px; border: 1px solid #d9d9d9; border-radius: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; -o-border-radius: 5px; -ms-border-radius: 5px; padding: 5px; }
    .single-page .tableform h5 { color: #305c89; }
    .single-page .tableform th { font-weight: normal; font-size: 12px; }

    .spage-sidebar-wrap { display: none; }

    .single-page-col2 #main { overflow: inherit; overflow-y: scroll; }

    .single-page-col2 .spage-main-box { margin: 10px 0 20px; }

    .division { background: white; border: 1px solid #dbdbdb; margin: 5px; padding: 5px 7px; zoom: 1; overflow: hidden; }

    .division .tableform { background: white; padding: 10px 15px; margin: 5px 0; }

    .spage-side-nav { margin: 15px 0 5px; color: #3F4D69; }
    .spage-side-nav ul { margin: 0; }
    .spage-side-nav li { list-style: none; padding: 0; height: 23px; line-height: 23px; overflow: hidden; }
    .spage-side-nav li span { padding: 0 0 0 20px; display: block; cursor: pointer; }
    .spage-side-nav .cur { background: url(images/tile_bg.png) repeat-x 0 -1200px; color: white; font-weight: bold; }

    ul.tag-editor-group { padding: 6px 10px; }

    .spage-main-box { margin: 0; padding: 0; zoom: 1; }
    .spage-main-box .tag-editor-group li { list-style: none; }
    .spage-main-box h3 { font-size: 14px; color: black; font-weight: bold; height: 23px; line-height: 23px; margin: 0 6px; }
    .spage-main-box h4 { font-size: 12px; padding: 5px 2px; border-top: none; }

    .gener-bj { background: url(images/tile_bg.png) repeat-x 0 -1131px; height: 15px; overflow: hidden; width: 0px; }

    /*图片编辑器*/
    .gpic-box { float: left; margin: 2px; cursor: pointer; background: white; }
    .gpic-box .gpic { width: 90px; height: 90px; vertical-align: middle; overflow: hidden; border: 1px #cccccc solid; text-align: center; }
    .gpic-box .gpic i { font-size: 11px; opacity: 0.7; filter: alpha(opacity=70); display: none; font-style: normal; width: 50px; background: #ff3300; color: white; padding: 3px; margin: -90px -40px 0 0; }
    .gpic-box img { vertical-align: middle; border: 1px white solid; }
    .gpic-box .current { border: 1px solid #ff3300; }
    .gpic-box .current i { display: block; }

    .gpic-box-delete { border: 1px solid #cccccc; border-top: none; text-align: center; background: #f2f2f2; }

    .gpic-btn-bar { border: 1px solid #cccccc; border-top: none; text-align: center; height: 15px; width: 90px; background: #f2f2f2; color: #c8c8c8; font-size: 8px; line-height: 14px; }
    .gpic-btn-bar span { display: inline-block; *display: inline; *zoom: 1; width: 10px; height: 10px; font-size: 0; background-position: 0 -300px; border: 0 none; padding: 0 6px; margin: 2px 0 0; overflow: hidden; }
    .gpic-btn-bar i { visibility: hidden; }

    span.gpic-btn-view { background-position: 0 -300px; }

    span.gpic-btn-view:hover { background-position: 0 -320px; }

    span.gpic-btn-delete { background-position: 0 -340px; }

    span.gpic-btn-delete:hover { background-position: 0 -360px; }

    #all-pics { overflow: hidden; width: 290px; margin: 0 auto; }

    #x-main-pic { background: white; border: 1px solid #e9e9e9; overflow: hidden; width: 285px; height: 220px; margin: 5px auto; border-right-color: #cccccc; border-bottom-color: #cccccc; }

    #x-main-pic .imgbox { width: 220px; height: 200px; background-color: white; background-repeat: no-repeat; background-position: 50% 50%; }

    .x-view-img { line-height: 15px; background-position: 0 -84px; border: 0 none !important; cursor: pointer; }

    .x-view-img:hover { background-position: 0 -108px; }

    .spage-main-box { margin: 0; padding: 0; zoom: 1; }
    .spage-main-box .tag-editor-group li { list-style: none; }
    .spage-main-box h3 { font-size: 14px; color: black; font-weight: bold; height: 23px; line-height: 23px; margin: 0 6px; }
    .spage-main-box h4 { font-size: 12px; padding: 5px 2px; border-top: none; }


    .division {
        background: white;
        border: 1px solid #dbdbdb;
        margin: 5px;
        padding: 5px 7px;
        zoom: 1;
        overflow: hidden;
    }

    .tableform { margin: 5px 5px 10px; }
    .tableform h4 { font-size: 12px; margin: 5px;  padding: 10px 10px 0; }
    .tableform h5 { color: #333; font-size: 12px; margin: 0 0 5px; padding: 0 5px; }
    .tableform .first, .tableform .division h4 { border: none; }
    .tableform .division td a { *padding: 2px 5px 0 5px; padding: 2px 5px; margin: 0 3px; color: #000; line-height: 20px; }
    .tableform th, .tableform td { padding: 7px 5px; vertical-align: top; }
    .tableform th { text-align: right; font-weight: normal; white-space: nowrap; width: 120px; padding-right: 5px; color: #4f4f4f; }
    .tableform td { white-space: normal; }
    .tableform table { padding: 0; }
    .tableform h5.head-title { border-bottom: 1px solid #dddddd; }
    .tableform .red { font-weight: bold; margin: 0 2px; }
    .tableform .intro { color: #369; padding-left: 15px; }
    .table-action {
        border-top: 1px solid #E0E0E0;
        padding: 10px 0;
        height: 35px;
        line-height: 35px;
        margin: 5px 0 0 0;
        text-align: center;
        clear: both;
    }
    table {
        width: 100%;
        border-collapse: collapse;
    }
    .btn {
        display: inline-block;
        background: transparent;
        height: 23px;
        line-height: 23px;
        overflow: visible;
        padding: 0;
        margin: 0 1px;
        border: 0 none;
        text-decoration: none;
        vertical-align: middle;
        font-size: 12px;
        font-weight: normal;
        cursor: pointer;
    }
    .notice {
        background-color: #FFF9CF;
        color: #514721;
        border-color: #FFD324;
        padding: .3em .7em;
        margin-bottom: 1em;
        border: 1px solid #dddddd;
        font-size: 12px;
    }
    .span-auto{
        float: left;
        margin-left: 10px;
    }


</style>
<div class="single-page ">
<div class="tableform" id="x-order_tableform">
    <table cellspacing="0" cellpadding="0" border="0" width="100%"><tbody><tr><td>
        <h4>收货地址信息</h4>
    </td>
    </tr>
    </tbody></table>
    <form action="{:U('Orders/saveDliAddr')}" method="post" id="saveAddr">
        <input type="hidden" name="order[order_id]" value="{$printDelivery['detail']['order_id']}">

    <div class="division">
        <table cellspacing="0" cellpadding="0" border="0" width="100%">
            <tbody><tr>
                    <th>姓名：</th>
                <td colspan="3"><input size="10" style="width:80px;" value="{$printDelivery['detail']['ship_name']}" class="item itemrow _x_ipt" name="order[ship_name]" autocomplete="off"></td>
                <td rowspan="5" style="vertical-align:middle;">
                    <center><div class="" style="width:150px;">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tbody><tr>
                                <td style="text-align:left; color:#aaaaaa;font-size: 12px;">您也可以将编辑过的收货地址更新至订单</td>
                            </tr>
                            <tr>
                                <td style="height:40px;">
  <a style="padding: 4px 8px;font-size: 12px; background: #E7E7E7; border: 2px solid #ddd; cursor:pointer;" id="btn_save_addr">保存订单地址</a></td>
                            </tr>
                            </tbody></table></div></center></td>
            </tr>

            <tr>
                <th>省区：</th>
                <td><span style="font-size: 13px;">{$printDelivery['detail']['ship_area']}</span></td>

            </tr>
            <tr>
                <th>地址：</th>
                <td colspan="3"><input size="50" style="width:400px;" class="item itemrow _x_ipt" name="order[ship_addr]" value="{$printDelivery['detail']['ship_addr']}" autocomplete="off"></td>
            </tr>

            <tr>
                <th>手机：</th>
                <td><input size="36" style="width:145px;" class="item itemrow _x_ipt" value="{$printDelivery['detail']['ship_mobile']}" name="order[ship_mobile]" autocomplete="off"></td>

            </tr>
            <tr>
                <th>备注：</th>
                <td colspan="3"><input size="50" style="width:400px;" class="item itemrow _x_ipt" name="order[memo]" value="{$printDelivery['detail']['memo']}" autocomplete="off"></td>
            </tr>
            </tbody></table>
    </div>
    </form>

    <form id="dly_printer_form" action="{:U('Orders/orderPrintKd')}" method="post">
    <h4>发货地址信息</h4>
    <if condition="$dlyList eq ''">
        <div class="notice"> 系统发货信息为空,请返回后台管理发货信息</div>
        <else/>

        <div class="division">
            <lebel style="font-size: 12px;">发货点选择:</lebel>
            <select name="dly_center" class="field" id="dly_center_select">
                <volist name="dlyList" id="isdlyList">
                <option value="{$isdlyList['dly_center_id']}" <if condition="$isdlyList['disabled'] eq 'true'"> selected="selected"</if>>{$isdlyList['name']}</option>
                    </volist>
            </select>
        </div>

        <div class="division" id="dly_center_row" style="font-size: 12px;">
            <table border="0" cellpadding="0" cellspacing="0" style="font-size: 12px;">
                <tbody><tr>
                    <th>姓名：</th><td>{$isdlyList['name']}</td>
                    <th>地区：</th><td>{$isdlyList['region']}</td>
                </tr>
                <tr>
                    <th>邮编：</th><td>{$isdlyList['zip']}</td>
                    <th>地址：</th><td>{$isdlyList['address']}</td>
                </tr>
                <tr>
                    <th>手机：</th><td>{$isdlyList['cellphone']}</td>
                    <th>电话：</th><td>{$isdlyList['phone']}</td>
                </tr>
                </tbody>
            </table>
        </div>

    </if>


        <input type="hidden" value="{$printDelivery['detail']['order_id']}" name="order_id">

    <h4>快递单模板</h4>
    <if condition="$dlyTmpl eq ''">
    <div class="notice"> 快递单模板信息为空，请先添加模块</div>
        <else/>
    <div class="division clearfix" style="font-size: 12px;">
        <volist name="dlyTmpl" id="dlyTmpl">
        <div class="span-auto">
            <label>
                <input type="radio" name="prt_tmpl_id"  <if condition="$i eq 1">checked</if> value="{$dlyTmpl['prt_tmpl_id']}">{$dlyTmpl['prt_tmpl_title']}</label>
        </div>
        </volist>
    </div>

    <table class="table-action">
        <tbody><tr>
            <td>
                <button type="button" onclick="$('dly_printer_form').submit();" class="btn btn-primary"><span><span style="padding:7px 15px; background: #5B81AD;color: #fff; border-radius: 3px;" data-id="{:U('Orders/orderPrintKd',['order_id'=>$printDelivery['detail']['order_id']])}" id="sure">确认</span></span></button>
            </td>
        </tr>
        </tbody></table>

    </if>
</form>


</div>
</div>
<script src="__PUBLIC__/Home/js/jquery.min.js"></script>
<script src="/Public/layer/layer.js"></script>

<script>




    $('#btn_save_addr').on('click',function () {
        $.ajax({
            url:$('form').attr('action'),
            data:$('#saveAddr').serialize(),
            dataType:'json',
            type:'post',
            success:function(data){
                if(data.status==1){
                    alert(data.msg);
                }else{
                    alert(data.msg);
                }
            },
            error:function () {
                alert('失败');
            }
        })
    })

    $('.field').change(function () {
        var v = $(this).val();
        $.ajax({
            url:'/Qgs/Orders/changeContent',
            data:{'id': v},
            dataType:'json',
            type:'post',
            success:function(data){
                 if(data.status==1){
                     $("#dly_center_row").html(data.msg);
                }
            },
            error:function () {
                alert('失败');
            }
        })
    })

    $('#sure').on('click',function () {
            var dataId = $(this).data('id');

            $.ajax({
                url:'/Qgs/Orders/orderPrintKd',
                data:$('#dly_printer_form').serialize(),
                dataType:'json',
                type:'post',
                success:function(data){

                    layer.open({
                        type: 1,
                        skin: 'layui-layer-rim', //加上边框
                        area: [data.width, data.height], //宽高
                        content: data.html
                    });

                },
                error:function () {
                    alert('失败');
                }
            })

    })


 </script>